<h3 class="dashboard-settings__header">
  <a ng-click="ctrl.switchMode('list')"><!--Versions-->版本管理</a>
  <span ng-show="ctrl.mode === 'compare'">
    &gt; <!--Comparing-->比较 {{ctrl.baseInfo.version}}
    <i class="fa fa-arrows-h"></i>
    {{ctrl.newInfo.version}}
    <cite class="muted" ng-if="ctrl.isNewLatest"><!--(Latest)-->（最新）</cite>
  </span>
</h3>

<div ng-if="ctrl.mode === 'list'">
  <div ng-if="ctrl.loading">
    <i class="fa fa-spinner fa-spin"></i>
    <em><!--Fetching history list-->获取历史列表&hellip;</em>
  </div>

  <div ng-if="!ctrl.loading">
    <div class="gf-form-group">
      <table class="filter-table">
        <thead>
          <tr>
            <th class="width-4"></th>
            <th class="width-4"><!--Version-->版本</th>
            <th class="width-14"><!--Date-->日期</th>
            <th class="width-10"><!--Updated By-->更新者</th>
            <th><!--Notes-->注释</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="revision in ctrl.revisions">
            <td class="filter-table__switch-cell" bs-tooltip="!revision.checked && ctrl.canCompare ? '您只能一次比较两个版本' : ''" data-placement="right"><!--You can only compare 2 versions at a time-->
              <gf-form-switch switch-class="gf-form-switch--table-cell" checked="revision.checked" on-change="ctrl.revisionSelectionChanged()" ng-disabled="!revision.checked && ctrl.canCompare">
              </gf-form-switch>
            </td>
            <td class="text-center">{{revision.version}}</td>
            <td>{{revision.createdDateString}}</td>
            <td>{{revision.createdBy}}</td>
            <td>{{revision.message}}</td>
            <td class="text-right">
              <a class="btn btn-inverse btn-small" ng-show="revision.version !== ctrl.dashboard.version" ng-click="ctrl.restore(revision.version)">
                <i class="fa fa-history"></i>&nbsp;&nbsp;<!--Restore-->恢复
              </a>
              <a class="btn btn-outline-disabled btn-small" ng-show="revision.version === ctrl.dashboard.version">
                <i class="fa fa-check"></i>&nbsp;&nbsp;<!--Latest-->最新
              </a>
            </td>
          </tr>
        </tbody>
      </table>

      <div ng-if="ctrl.appending">
        <i class="fa fa-spinner fa-spin"></i>
        <em><!--Fetching more entries-->获取更多条目&hellip;</em>
      </div>

      <div class="gf-form-group">
        <div class="gf-form-button-row">
          <button  type="button"
                   class="btn gf-form-button btn-inverse"
                   ng-if="ctrl.revisions.length >= ctrl.limit"
                   ng-click="ctrl.addToLog()"
                   ng-disabled="ctrl.isLastPage()">
            <!--Show more versions-->显示更多版本
          </button>
          <button type="button"
                  class="btn btn-success"
                  ng-if="ctrl.revisions.length > 1"
                  ng-disabled="!ctrl.canCompare"
                  ng-click="ctrl.getDiff(ctrl.diff)"
                  bs-tooltip="ctrl.canCompare ? '' : '选择2个版本开始比较'" data-placement="bottom">
            <i class="fa fa-code-fork" ></i>&nbsp;&nbsp;<!--Compare versions-->比较版本
          </button>
        </div>
      </div>
    </div>
  </div>
</div>

<div ng-if="ctrl.mode === 'compare'">
  <div ng-if="ctrl.loading">
    <i class="fa fa-spinner fa-spin"></i>
    <em><!--Fetching changes-->获取改动&hellip;</em>
  </div>

  <div ng-if="!ctrl.loading">
    <button  type="button"
             class="btn btn-danger pull-right"
             ng-click="ctrl.restore(ctrl.baseInfo.version)"
             ng-if="ctrl.isNewLatest">
      <i class="fa fa-history" ></i>&nbsp;&nbsp;<!--Restore to version-->恢复到版本 {{ctrl.baseInfo.version}}
    </button>
    <section>
      <p class="small muted">
      <strong><!--Version-->版本 {{ctrl.newInfo.version}}</strong> <!--updated by-->更新者
      <span>{{ctrl.newInfo.createdBy}} </span>
      <span>{{ctrl.newInfo.ageString}}</span>
      <span> - {{ctrl.newInfo.message}}</span>
      </p>
      <p class="small muted">
      <strong><!--Version-->版本 {{ctrl.baseInfo.version}}</strong> <!--updated by-->更新者
      <span>{{ctrl.baseInfo.createdBy}} </span>
      <span>{{ctrl.baseInfo.ageString}}</span>
      <span> - {{ctrl.baseInfo.message}}</span>
      </p>
    </section>

    <div id="delta" diff-delta>
      <div class="delta-basic" compile="ctrl.delta.basic"></div>
    </div>

    <div class="gf-form-button-row">
      <button class="btn btn-secondary" ng-click="ctrl.getDiff('json')">查看 JSON Diff</button><!--View JSON Diff-->
    </div>

    <div class="delta-html" ng-show="ctrl.diff === 'json'" compile="ctrl.delta.json"></div>
  </div>
</div>
